package com.ax.associator.storepharmacist.service.serviceImpl;

import com.ax.associator.store.common.utils.ErrorUtil;
import com.ax.associator.store.common.utils.PageUtils;
import com.ax.associator.store.common.utils.Query;
import com.ax.associator.store.dao.BaseAssociatorMapper;
import com.ax.associator.store.dao.PrescriptionAuditMapper;
import com.ax.associator.storepharmacist.dao.BaseDrugstoreMapper;
import com.ax.associator.storepharmacist.domain.DrugstoreDto;
import com.ax.associator.storepharmacist.service.BaseDrugstoreService;
import org.apache.shiro.util.Assert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class BaseDrugstoreServiceImpl implements BaseDrugstoreService {


    @Autowired
    private BaseDrugstoreMapper baseDrugstoreMapper;

    @Autowired
    private PrescriptionAuditMapper prescriptionAuditMapper;

    @Override
    public PageUtils queryDrugstore(Map<String,Object> map) {
        Query query=new Query(map);
        List<DrugstoreDto> list=baseDrugstoreMapper.queryDrugstore(query);
        for(DrugstoreDto li:list){
            Integer no=prescriptionAuditMapper.queryPharmacistServiceNo(li.getPharmacistId());
            li.setNo(no);
        }
        Integer count=baseDrugstoreMapper.queryDrugstoreNo(map);

        PageUtils pageUtils=new PageUtils(list,count);
        return pageUtils;
    }
}
